package com.ghxxzx.dagl.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ghxxzx.dagl.vo.PageQuery;
import com.ghxxzx.dagl.vo.PageResult;
import org.apache.poi.ss.formula.functions.T;

/**
 * desc:
 *
 * @author cx316
 * Created by cx316 on 2020-05-27.
 */
public class PageResultUtils {
    public static PageResult generatePageResult(Page page, PageQuery pageQuery){
        PageResult pageResult = new PageResult();
        pageResult.setData(page.getRecords());
        pageResult.setTotal(Long.valueOf(page.getTotal()).intValue());
        pageResult.setPageNum(pageQuery.getPageNum());
        pageResult.setPageSize(pageQuery.getPageSize());
        return pageResult;
    }
    public static <T> Page getPage(PageQuery pageQuery, T t){
        Page<T> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
        return page;
    }
}
